package com.worthtech.billportal.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.worthtech.billportal.form.PermissionForm;
import com.worthtech.billportal.service.PermissionService;

public class PermissionAction extends BaseAction {

	private PermissionService permissionService;

public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		PermissionForm permissionForm = (PermissionForm) form;
		if ("index".equals(permissionForm.getAction())) {
			List permissionList = this.getPermissionService().getPermissionList(permissionForm.getMenuId());
			request.setAttribute("permissionList",permissionList);
			return mapping.findForward("list");
		}
		return null;
	}	public PermissionService getPermissionService() {
		return permissionService;
	}

	public void setPermissionService(PermissionService permissionService) {
		this.permissionService = permissionService;
	}

}
